#ifndef _OCPP_Request_H__
#define _OCPP_Request_H__

#include "Any.h"

namespace OCPP
{
	class _MainExport Request
	{
		friend class WorkQueue;
	protected:
		/// The request channel, as an integer 
		uint16 mChannel;
		/// The request type, as an integer within the channel (user can define enumerations on this)
		uint16 mType;
		/// The details of the request (user defined)
		Any mData;
		/// Retry count - set this to non-zero to have the request try again on failure
		uint8 mRetryCount;
		/// Identifier (assigned by the system)
		RequestID mID;
		/// Abort Flag
		mutable bool mAborted;

	public:
		/// Constructor 
		Request(uint16 channel, uint16 rtype, const Any& rData, uint8 retry, RequestID rid);
		~Request();
		/// Set the abort flag
		void abortRequest() const { mAborted = true; }
		/// Get the request channel (top level categorisation)
		uint16 getChannel() const { return mChannel; }
		/// Get the type of this request within the given channel
		uint16 getType() const { return mType; }
		/// Get the user details of this request
		const Any& getData() const { return mData; }
		/// Get the remaining retry count
		uint8 getRetryCount() const { return mRetryCount; }
		/// Get the identifier of this request
		RequestID getID() const { return mID; }
		/// Get the abort flag
		bool getAborted() const { return mAborted; }
	};
}
#endif
